// 模拟后端动态生成路由
import { defineFakeRoute } from "vite-plugin-fake-server/client";

/**
 * roles：页面级别权限，这里模拟二种 "admin"、"common"
 * admin：管理员角色
 * common：普通角色
 */
// const permissionRouter = {
//   path: "/permission",
//   meta: {
//     title: "menus.purePermission",
//     icon: "ep:lollipop",
//     rank: 10
//   },
//   children: [
//     {
//       path: "/permission/page/index",
//       name: "PermissionPage",
//       meta: {
//         title: "menus.purePermissionPage",
//         roles: ["admin", "common"]
//       }
//     },
//     {
//       path: "/permission/button/index",
//       name: "PermissionButton",
//       meta: {
//         title: "menus.purePermissionButton",
//         roles: ["admin", "common"],
//         auths: [
//           "permission:btn:add",
//           "permission:btn:edit",
//           "permission:btn:delete"
//         ]
//       }
//     }
//   ]
// };

const factory = [
  // {
  //   path: "/dataAnalysis",
  //   meta: {
  //     title: "menus.dataAnalysis",
  //     icon: "ep:lollipop",
  //     rank: 10
  //   },
  //   children: [
  //     {
  //       path: "/dataAnalysis/deviceData",
  //       component: "factory/dataAnalysis/deviceData/index",
  //       name: "FactoryDeviceData",
  //       meta: {
  //         title: "menus.purePermissionPage"
  //       }
  //     },
  //     {
  //       path: "/dataAnalysis/lossData",
  //       component: "factory/dataAnalysis/lossData/index",
  //       name: "FactoryLossData",
  //       meta: {
  //         title: "menus.purePermissionPage"
  //       }
  //     },
  //     {
  //       path: "/dataAnalysis/productionData",
  //       component: "factory/dataAnalysis/productionData/index",
  //       name: "FactoryProductionData",
  //       meta: {
  //         title: "menus.prodData"
  //       }
  //     },
  //     {
  //       path: "/dataAnalysis/cleanData",
  //       component: "factory/dataAnalysis/cleanData/index",
  //       name: "FactoryCleanData",
  //       meta: {
  //         title: "menus.prodData"
  //       }
  //     }
  //   ]
  // },
  {
    path: "/deviceTerminal",
    meta: {
      title: "menus.deviceTerminal",
      zhTitle: "设备终端",
      icon: "ep:lollipop",
      rank: 11
    },
    children: [
      {
        path: "/deviceTerminal/deviceManage",
        component: "factory/deviceTerminal/deviceManage/index",
        name: "FactoryDeviceManage",
        meta: {
          title: "menus.deviceManage"
        }
      },
      {
        path: "/deviceTerminal/deviceModel",
        component: "factory/deviceTerminal/deviceModel/index",
        // component: "factory/deviceTerminal/deviceModel/index",
        name: "FactoryDeviceModel",
        meta: {
          title: "menus.deviceModel"
        }
      }
      // {
      //   path: "/deviceTerminal/deviceRegion",
      //   component: "factory/deviceTerminal/deviceRegion/index",
      //   name: "FactoryDeviceRegion",
      //   meta: {
      //     title: "设备地域"
      //   }
      // }
    ]
  },
  {
    path: "/deviceMaintain",
    meta: {
      title: "menus.deviceMaintain",
      zhTitle: "设备维护",
      icon: "ep:lollipop",
      rank: 12
    },
    children: [
      {
        path: "/deviceMaintain/checkUpdate",
        // component: "factory/deviceTerminal/deviceManage/index",
        component: "factory/deviceMaintain/checkUpdate/index",
        name: "FactoryCheckUpdate",
        meta: {
          keepAlive: true,
          title: "menus.checkUpdate"
        }
      },

      {
        path: "/deviceMaintain/softwareRecord",
        // component: "factory/deviceTerminal/deviceManage/index",
        component: "factory/deviceMaintain/checkUpdate/softwareRecord",
        name: "FactorySoftwareRecord",
        meta: {
          title: "menus.softwareRecord",
          activePath: "/deviceMaintain/checkUpdate",
          showLink: false
        }
      }
    ]
  },
  {
    path: "/business",
    meta: {
      title: "menus.business",
      zhTitle: "商家管理",
      icon: "ep:lollipop",
      rank: 12
    },
    children: [
      {
        path: "/business/businessManage",
        component: "factory/business/businessManage/index",
        // component: "factory/business/businessManage/index",
        name: "FactoryBusinessManage",
        meta: {
          title: "menus.businessManage"
        }
      }
    ]
  }
  // {
  //   path: "/document",
  //   meta: {
  //     title: "menus.document",
  //     zhTitle: "使用文档",
  //     icon: "ep:lollipop",
  //     rank: 12
  //   },
  //   children: [
  //     {
  //       path: "/document/factory",
  //       name: "FactoryDocFactory",
  //       meta: {
  //         keepAlive: true,
  //         frameSrc: "/柜式机厂家后台使用说明文档.pdf",
  //         title: "menus.docFactory"
  //       }
  //     },
  //     {
  //       path: "/document/store",
  //       name: "FactoryDocStore",
  //       meta: {
  //         keepAlive: true,
  //         frameSrc: "/柜式机商家后台使用说明文档.pdf",
  //         title: "menus.docStore"
  //       }
  //     }
  //   ]
  // }
];
//   柜式机集合
const cabinet = [
  {
    path: "/analysis",
    meta: {
      title: "menus.dataAnalysis",
      zhTitle: "数据分析",
      icon: "ep:lollipop",
      rank: 10
    },
    children: [
      {
        path: "/analysis/materialData",
        component: "cabinet/analysis/materialData/index",
        name: "MaterialData",
        meta: {
          title: "menus.materialData",
          zhTitle: "物料数据"
        }
      },
      {
        path: "/analysis/materialDetails",
        component: "cabinet/analysis/materialDetails/index",
        name: "MaterialDetails",
        meta: {
          title: "menus.materialDetails",
          zhTitle: "物料明细"
        }
      },
      {
        path: "/analysis/prodData",
        component: "cabinet/analysis/prodData/index",
        name: "prodData",
        meta: {
          title: "menus.prodData",
          zhTitle: "生产数据"
        }
      },
      {
        path: "/analysis/prodDetails",
        component: "cabinet/analysis/prodDetails/index",
        name: "ProdDetails",
        meta: {
          title: "menus.prodDetails",
          zhTitle: "生产明细"
        }
      },
      {
        path: "/analysis/cleanDisData",
        component: "cabinet/analysis/cleanDisData/index",
        name: "CleanDisData",
        meta: {
          title: "menus.cleanDisData",
          zhTitle: "清洗消毒数据"
        }
      }
    ]
  },
  {
    path: "/supervise",
    meta: {
      title: "menus.supervise",
      zhTitle: "经营监管",
      icon: "ep:lollipop",
      rank: 11
    },
    children: [
      {
        path: "/supervise/superviseData",
        component: "cabinet/supervise/superviseData/index",
        name: "SuperviseData",
        meta: {
          title: "menus.superviseData",
          zhTitle: "监管数据"
        }
      },
      {
        path: "/supervise/standardSupervise",
        component: "cabinet/supervise/standardSupervise/index",
        name: "StandardSupervise",
        meta: {
          title: "menus.standardSupervise",
          zhTitle: "经营标准"
        }
      }
    ]
  },
  {
    path: "/warning",
    meta: {
      title: "menus.ownWarning",
      zhTitle: "我的预警",
      icon: "ep:lollipop",
      rank: 12
    },
    children: [
      {
        path: "/warning/warningData",
        component: "cabinet/warning/warningData/index",
        name: "WarningData",
        meta: {
          title: "menus.warningData",
          zhTitle: "预警数据"
        }
      },
      {
        path: "/warning/warningManage",
        component: "cabinet/warning/warningManage/index",
        name: "warningManage",
        meta: {
          title: "menus.warningManage",
          zhTitle: "预警管理"
        }
      }
    ]
  },
  {
    path: "/formula",
    meta: {
      title: "menus.formula",
      zhTitle: "配方中心",
      icon: "ep:lollipop",
      rank: 13
    },
    children: [
      {
        path: "/formula/formulaManage",
        component: "cabinet/formula/formulaManage/index",
        name: "FormulaManage",
        meta: {
          title: "menus.formulaManage",
          zhTitle: "配方管理"
        }
      },
      {
        path: "/formula/materialManage",
        component: "cabinet/formula/materialManage/index",
        name: "FormulaMaterialManage",
        meta: {
          title: "menus.materialManage",
          zhTitle: "物料管理"
        }
      },
      {
        path: "/formula/labelManage",
        component: "cabinet/formula/labelManage/index",
        name: "LabelManage",
        meta: {
          title: "menus.labelManagement",
          zhTitle: "标签管理"
        }
      },
      {
        path: "/formula/specsManage",
        component: "cabinet/formula/specsManage/index",
        name: "SpecsManage",
        meta: {
          title: "menus.specsManage",
          zhTitle: "规格管理"
        }
      },
      {
        path: "/formula/materialType",
        component: "cabinet/formula/materialType/index",
        name: "MaterialType",
        meta: {
          title: "menus.materialType",
          zhTitle: "物料类型"
        }
      }
    ]
  },
  {
    path: "/ownFormula",
    meta: {
      title: "menus.ownFormula",
      zhTitle: "我的配方",
      icon: "ep:lollipop",
      rank: 14
    },
    children: [
      {
        path: "/ownFormula/formulaManage",
        component: "cabinet/ownFormula/formulaManage/index",
        name: "OwnFormulaManage",
        meta: {
          title: "menus.formulaManage",
          zhTitle: "配方管理"
        }
      },
      {
        path: "/ownFormula/materialManage",
        component: "cabinet/ownFormula/materialManage/index",
        name: "OwnMaterialManage",
        meta: {
          title: "menus.materialManage",
          zhTitle: "物料管理"
        }
      }
    ]
  },
  {
    path: "/device",
    meta: {
      title: "menus.equipmentTerminal",
      zhTitle: "设备终端",
      icon: "ep:lollipop",
      rank: 15
    },
    children: [
      {
        path: "/device/deviceCleanManage",
        component: "cabinet/device/deviceCleanManage/index",
        name: "DeviceCleanManage",
        meta: {
          title: "menus.deviceCleanManage",
          zhTitle: "设备清洗管理",
          showParent: true
        }
      }
    ]
  }
];

const deviceRouter = {
  path: "/device",
  name: "Device",
  redirect: "/device/deviceManage",
  meta: {
    icon: "IF-icon-device",
    title: "menus.device",
    rank: 12
  },
  children: [
    {
      path: "/device/deviceManage",
      name: "DeviceManage",
      component: "teaInfuser/device/deviceManage/index",
      meta: {
        title: "menus.deviceManage"
      }
    },
    // {
    //   path: "/device/deviceRegion",
    //   name: "DeviceRegion",
    //   component: "allDevice/device/deviceRegion/index",
    //   meta: {
    //     title: "menus.deviceRegion"
    //   }
    // },
    {
      path: "/device/deviceClean",
      name: "DeviceClean",
      component: "cabinet/device/deviceClean/index",
      meta: {
        title: "menus.deviceClean"
      }
    },
    {
      path: "/device/lockRecord",
      name: "DeviceLockRecord",
      component: "teaInfuser/device/deviceManage/recordPage",
      meta: {
        title: "menus.deviceManage",
        activePath: "/device/deviceManage",
        showLink: false
      }
    }
  ]
};

const storeRouter = {
  path: "/store",
  name: "Store",
  redirect: "/store/storeGroup",
  meta: {
    icon: "IF-icon-shop",
    title: "menus.store",
    rank: 13
  },
  children: [
    {
      path: "/store/storeGroup",
      name: "storeGroup",
      component: "/teaInfuser/store/storeGroup/index",
      meta: {
        title: "menus.storeGroup"
      }
    },
    {
      path: "/store/storeDevice",
      name: "StoreDevice",
      component: "/teaInfuser/store/storeGroup/storeDevice",
      meta: {
        title: "menus.storeDevice",
        showLink: false,
        activePath: "/store/storeGroup"
      }
    },
    {
      path: "/store/storeManage",
      name: "StoreManage",
      component: "/teaInfuser/store/storeManage/index",
      meta: {
        title: "menus.storeManage"
      }
    },
    {
      path: "/store/storeManageDevice",
      name: "StoreManageDevice",
      component: "/teaInfuser/store/storeManage/device",
      meta: {
        title: "menus.storeDevice",
        showLink: false,
        activePath: "/store/storeManage"
      }
    },
    {
      path: "/store/storeSupervise",
      name: "StoreSupervise",
      component: "/teaInfuser/store/storeSupervise/index",
      meta: {
        title: "menus.storeSupervise"
      }
    },
    {
      path: "/store/storeSupRecord",
      name: "StoreSupRecord",
      component: "/teaInfuser/store/storeSupervise/record",
      meta: {
        title: "menus.storeSupRecord",
        showLink: false,
        activePath: "/store/storeSupRecord"
      }
    },
    {
      path: "/personnel/personManage",
      name: "personManage",
      component: "/expiry/personnel/index.vue",
      meta: {
        title: "menus.personManage"
      }
    },
    {
      path: "/personnel/personDetail",
      name: "personDetail",
      component: "/expiry/personnel/personDetail",
      meta: {
        title: "menus.personManage",
        showLink: false,
        activePath: "/personnel/personManage"
      }
    }
  ]
};

const accountRouter = {
  path: "/account",
  name: "Account",
  redirect: "/account/accountManage",
  meta: {
    icon: "eos-icons:cluster-management",
    title: "menus.systemSet",
    rank: 13
  },
  children: [
    {
      path: "/account/accountManage",
      name: "AccountManage",
      component: "/teaInfuser/account/accountManage/index",
      meta: {
        title: "menus.accountManage",
        keepAlive: true
      }
    },
    {
      path: "/account/roleManage",
      name: "RoleManage",
      component: "/teaInfuser/account/roleManage/index",
      meta: {
        title: "menus.roleManage",
        keepAlive: true
      }
    }
  ]
};

const dashboardRouter = {
  path: "/dashboard",
  name: "DataAnalysis",
  redirect: "/dashboard/analysis",
  meta: {
    icon: "IF-icon-shujufenxi",
    title: "menus.dataAnalysis",
    rank: 10
  },
  children: [
    {
      path: "/dashboard/analysis",
      name: "DataAnalysis",
      component: "/teaInfuser/dashboard/analysis/index",
      meta: {
        title: "menus.dataAnalysis",
        keepAlive: true
      }
    }
  ]
};

const noticeRouter = {
  path: "/notice",
  name: "Notice",
  redirect: "/notice/storeNotice",
  meta: {
    icon: "ri:notification-3-fill",
    title: "menus.statusNotice",
    rank: 12
  },
  children: [
    {
      path: "/notice/storeNotice",
      name: "StatusNotice",
      component: "/teaInfuser/notice/statusNotice/index",
      meta: {
        title: "menus.statusNotice"
      }
    }
    // {
    //   path: "/notice/deviceNotice",
    //   name: "DeviceNotice",
    //   component: "/teaInfuser/notice/deviceNotice/index",
    //   meta: {
    //     title: "menus.deviceNotice",
    //     keepAlive: true
    //   }
    // }
  ]
};

//配方中心路由
const formulaCenterRouter = {
  path: "/formula/cabinet",
  name: "CabinetMachine",
  meta: {
    title: "menus.cabinetMachine"
  },
  children: [
    {
      path: "/formula/cabinet/formulaManage",
      name: "CabinetFormulaManage",
      component: "/cabinet/formula/formulaVersion/index",
      meta: {
        title: "menus.formula",
        showParent: true
      }
    },
    {
      path: "/formula/cabinet/specification",
      name: "CabinetSpecification",
      component: "/cabinet/formula/formulaDetail/specification",
      meta: {
        title: "menus.specification",
        showParent: true
      }
    },
    {
      path: "/formula/cabinet/tagManage",
      name: "CabinetTagManage",
      component: "/cabinet/formula/tagManage/index",
      meta: {
        title: "menus.tagManage",
        showParent: true
      }
    },
    {
      path: "/formula/cabinet/formulaList",
      name: "CabinetFormulaList",
      component: "/cabinet/formula/formulaList/index",
      meta: {
        title: "menus.formulaList",
        activePath: "/formula/cabinet/formulaManage",
        showLink: false
      }
    },
    {
      path: "/formula/cabinet/formulaDetail",
      name: "CabinetFormulaDetail",
      component: "/cabinet/formula/formulaDetail/index",
      meta: {
        title: "menus.cabinetFormulaDetail",
        activePath: "/formula/cabinet/formulaList",
        showLink: false
      }
    },
    {
      path: "formula/cabinet/formulaDetail/material",
      name: "CabinetDetailMaterial",
      component: "/cabinet/formula/formulaDetail/material",
      meta: {
        title: "menus.materialManage",
        activePath: "/cabinet/cabinet/formulaManage",
        showLink: false
      }
    }
    // {
    //   path: "formula/cabinet/formulaDetail/specification",
    //   name: "CabinetSpecification",
    //   component: "/cabinet/formula/formulaDetail/specification",
    //   meta: {
    //     title: "menus.specification",
    //     activePath: "/cabinet/formula/formulaDetail",
    //     showLink: false
    //   }
    // }
  ]
};

const formulaTeaPowder = {
  path: "/formula/teaPowder",
  name: "formulaTeaPowder",
  meta: {
    title: "menus.teaPowder"
  },
  children: [
    {
      path: "/formula/teaPowder/formulaVersion",
      name: "FormulaTeaPowderVersion",
      component: "teaPowder/formula/formulaVersion/index",
      meta: {
        title: "menus.matMatchVersion",
        showParent: true
      }
    },
    {
      path: "/formula/teaPowder/detail",
      name: "FormulaTeaPowderDetail",
      component: "teaPowder/formula/formulaDetail/index",
      meta: {
        title: "menus.matMatchDetail",
        activePath: "/formula/teaPowder/formulaVersion",
        showLink: false
      }
    }
  ]
};

const formulaPulper = {
  path: "/formula/pulper",
  name: "formulaPulper",
  meta: {
    title: "menus.pulper"
  },
  children: [
    {
      path: "/formula/pulper/formulaVersion",
      name: "FormulaPulperVersion",
      component: "pulper/formula/formulaVersion/index",
      meta: {
        title: "menus.formulaVersion",
        showParent: true
      }
    },
    {
      path: "/formula/pulper/detail",
      name: "FormulaPulperDetail",
      component: "pulper/formula/formulaDetail/index",
      meta: {
        title: "menus.formulaDetail",
        activePath: "/formula/pulper/formulaVersion",
        showLink: false
      }
    }
  ]
};

const formulaRouter = {
  path: "/formula",
  name: "Formula",
  redirect: "/formula/formulaVersion",
  meta: {
    icon: "IF-icon-formula",
    title: "menus.formula",
    rank: 11
  },
  children: [
    {
      path: "/formula/makeTea",
      name: "MakeTea",
      meta: {
        title: "menus.teaMakingMachine"
      },
      children: [
        {
          path: "/formula/makeTea/formulaVersion",
          name: "FormulaVersion",
          component: "teaInfuser/formula/formulaVersion/index",
          meta: {
            title: "menus.formulaVersion",
            showParent: true
          }
        },
        {
          path: "/formula/makeTea/detail",
          name: "FormulaDetail",
          component: "teaInfuser/formula/formulaDetail/index",
          meta: {
            title: "menus.formulaDetail",
            activePath: "/formula/makeTea/formulaVersion",
            showLink: false
          }
        }
      ]
    },
    formulaTeaPowder,
    formulaPulper,
    formulaCenterRouter
  ]
};

const expiryRouter = {
  path: "/expiry",
  name: "Expiry",
  redirect: "/expiry/material",
  meta: {
    icon: "tdesign:time-filled",
    title: "menus.expiryManage",
    rank: 12
  },
  children: [
    // {
    //   path: "/expiry/materialManage",
    //   name: "materialManage",
    //   component: "/expiry/material/materialManage/index",
    //   meta: {
    //     title: "menus.materialManage"
    //   }
    // },
    {
      path: "/expiry/expiryDetail",
      name: "expiryDetail",
      component: "/expiry/material/materialManage/expiryDetail",
      meta: {
        title: "menus.expiryDetail",
        activePath: "/expiry/materialVersion",
        showLink: false
      }
    },
    {
      path: "/expiry/materialVersion",
      name: "expiryMaterialVersion",
      component: "/expiry/material/materialVersion/index",
      meta: {
        title: "menus.expiryVersion",
        showParent: true
      }
    },
    {
      path: "/expiry/materialDetail",
      name: "expiryMaterialDetail",
      component: "/expiry/material/materialVersion/materialDetail",
      meta: {
        title: "menus.materialDetail",
        activePath: "/expiry/materialVersion",
        showLink: false
      }
    },
    {
      path: "/expiry/preparation",
      name: "expiryPreparation",
      component: "/expiry/material/preparation/index.vue",
      meta: {
        title: "menus.expiryPreparation",
        activePath: "/expiry/materialVersion",
        showLink: false
      }
    }
  ]
};

const taskRouter = {
  path: "/task",
  name: "Task",
  redirect: "/task/taskVersion",
  meta: {
    icon: "fluent:task-list-square-24-filled",
    title: "menus.taskTime",
    rank: 12
  },
  children: [
    {
      path: "/task/taskVersion",
      name: "taskVersion",
      component: "/expiry/task/taskVersion/index",
      meta: {
        title: "menus.taskVersion",
        showParent: true
      }
    },
    {
      path: "/task/taskTime",
      name: "taskTime",
      component: "/expiry/task/taskTime/index",
      meta: {
        title: "menus.expiryDetail",
        activePath: "/task/taskVersion",
        showLink: false
      }
    }
  ]
};

const matStoreRouter = {
  path: "/material",
  name: "Material",
  redirect: "/material/materialStore",
  meta: {
    icon: "material-symbols:inventory-2-sharp",
    title: "menus.materialStore",
    rank: 10
  },
  children: [
    {
      path: "/material/materialStore",
      component: "/cabinet/formula/materialManage/index",
      name: "MaterialManage",
      meta: {
        title: "menus.materialManage"
      }
    },

    {
      path: "/formula/cabinet/categoryManage",
      name: "CabinetCategoryManage",
      component: "/cabinet/formula/categoryManage/index",
      meta: {
        title: "menus.categoryManage",
        showParent: true
      }
    }
  ]
};

const makeTea = [
  {
    path: "/welcome",
    name: "Welcome",
    redirect: "/welcome/home",
    meta: {
      icon: "ep:home-filled",
      title: "menus.pureHome",
      rank: 0
    },
    children: [
      {
        path: "/welcome/home",
        name: "Welcome",
        component: "/welcome/index",
        meta: {
          title: "menus.pureHome"
        }
      }
    ]
  },
  dashboardRouter,
  deviceRouter,
  noticeRouter,
  matStoreRouter,
  formulaRouter,
  expiryRouter,
  taskRouter,
  storeRouter,
  accountRouter
  // formulaCenterRouter
];

const allDevice = [
  {
    path: "/all/store",
    meta: {
      icon: "ep:data-analysis",
      title: "menus.store",
      rank: 0
    },
    children: [
      {
        path: "/all/store/storeGroup",
        name: "AllStoreGroup",
        component: "allDevice/store/storeGroup/index",
        meta: {
          title: "menus.storeGroup"
        }
      },
      {
        path: "/all/store/storeManage",
        name: "AllStoreManage",
        component: "allDevice/store/storeManage/index",
        meta: {
          title: "menus.storeManage"
        }
      }
    ]
  },
  {
    path: "/all/device",
    meta: {
      icon: "ep:data-analysis",
      title: "menus.device",
      rank: 0
    },
    children: [
      {
        path: "/all/device/deviceManage",
        name: "AllDeviceManage",
        component: "allDevice/device/deviceManage/index",
        meta: {
          title: "menus.deviceManage"
        }
      },
      {
        path: "/all/device/deviceRegion",
        name: "DeviceRegion",
        component: "allDevice/device/deviceRegion/index",
        meta: {
          title: "menus.deviceRegion"
        }
      },
      {
        path: "/device/paramConfig",
        name: "ParamConfig",
        component: "allDevice/device/paramConfig/index",
        meta: {
          title: "menus.paramConfig"
        }
      }
    ]
  },
  {
    path: "/all/notify",
    meta: {
      icon: "ep:data-analysis",
      title: "menus.notifyMessage",
      rank: 0
    },
    children: [
      {
        path: "/all/notify/notifyMessage",
        name: "NotifyMessage",
        component: "allDevice/notify/notifyMessage/index",
        meta: {
          title: "menus.notifyMessage"
        }
      }
    ]
  },
  {
    path: "/all/system",
    meta: {
      icon: "ep:data-analysis",
      title: "menus.systemPermission",
      rank: 0
    },
    children: [
      {
        path: "/all/system/accountManage",
        name: "AccountManage",
        component: "allDevice/system/accountManage/index",
        meta: {
          title: "menus.accountManage"
        }
      },
      {
        path: "/all/system/deptManage",
        name: "DeptManage",
        component: "allDevice/system/deptManage/index",
        meta: {
          title: "menus.departmentManage"
        }
      },
      {
        path: "/all/system/postManage",
        name: "PostManage",
        component: "allDevice/system/postManage/index",
        meta: {
          title: "menus.postManage"
        }
      },
      {
        path: "/all/system/operateLog",
        name: "OperateLog",
        component: "allDevice/system/operateLog/index",
        meta: {
          title: "menus.operateLog"
        }
      }
    ]
  }
];

const factoryDevice = [
  {
    path: "/deviceTerminal",
    meta: {
      title: "menus.deviceTerminal",
      zhTitle: "设备终端",
      icon: "ep:lollipop",
      rank: 11
    },
    children: [
      {
        path: "/deviceTerminal/deviceManage",
        component: "factory/deviceTerminal/deviceManage/index",
        name: "FactoryDeviceManage",
        meta: {
          title: "menus.deviceImport"
        }
      }
      // {
      //   path: "/deviceTerminal/deviceModel",
      //   component: "factory/deviceTerminal/deviceModel/index",
      //   name: "FactoryDeviceModel",
      //   meta: {
      //     title: "设备型号"
      //   }
      // }
    ]
  }
];

const factoryUpdate = [
  {
    path: "/deviceMaintain",
    meta: {
      title: "menus.deviceMaintain",
      zhTitle: "设备维护",
      icon: "ep:lollipop",
      rank: 12
    },
    children: [
      {
        path: "/deviceMaintain/checkUpdate",
        component: "factory/deviceMaintain/checkUpdate/index",
        name: "FactoryCheckUpdate",
        meta: {
          keepAlive: true,
          title: "menus.checkUpdatePackage"
        }
      },

      {
        path: "/deviceMaintain/softwareRecord",
        // component: "factory/deviceTerminal/deviceManage/index",
        component: "factory/deviceMaintain/checkUpdate/softwareRecord",
        name: "FactorySoftwareRecord",
        meta: {
          title: "menus.softwareRecord",
          activePath: "/deviceMaintain/checkUpdate",
          showLink: false
        }
      }
    ]
  }
];

export default defineFakeRoute([
  {
    url: "/autata/get-async-routes",
    method: "post",
    response: ({ body }) => {
      const list = {
        cabinet,
        makeTea,
        allDevice
      };
      let data = [];
      if (body.userType == 0) {
        if (body.post == 63 || body.post == 94) {
          data = body.account === "设备导入" ? factoryDevice : factoryUpdate;
        } else {
          data = factory;
        }
      } else {
        const type = body.type === "factory" ? "makeTea" : body.type;
        data = list[type];
      }
      return {
        code: 200,
        data: data,
        error: null,
        message: "sucess",
        need_update: null,
        pageCount: 0,
        status: "ok",
        time: "2024-07-08 17:28:48",
        token: null
      };
    }
  }
]);
